# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.54)

m4_define([spotlighter_version], [0.3])
m4_define([gtk_required_version], [2.99.3])


AC_INIT([spotlighter], [spotlighter_version],
	http://code.google.com/p/ardesia/issues/list,
	[spotlighter])

AC_PREFIX_DEFAULT(/usr)
AC_CONFIG_SRCDIR([src/spotlighter.c])
AC_CONFIG_MACRO_DIR([m4macros])

AM_INIT_AUTOMAKE(no-define dist-bzip2)
AM_CONFIG_HEADER(config.h)

# Enable silent build rules by default, requires at least
# Automake-1.11. Disable by either passing --disable-silent-rules to
# configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

# gettext i18n support
GETTEXT_PACKAGE=spotlighter
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
                   [The prefix for our gettext translation domains.])

# Determine a C compiler to use
AC_PROG_CC
AM_PROG_CC_C_O

# Initialize libtool
AM_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

AM_PROG_AS

# Initialize maintainer mode
AM_MAINTAINER_MODE

# Honor aclocal flags
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"


# Check for pkg-config
PKG_PROG_PKG_CONFIG(0.16)

#################
# Check for Win32
#################
case "$host" in
  *-*-mingw*|*-*-cygwin*)
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac

######################
# Internationalisation
######################

IT_PROG_INTLTOOL([0.35.0],[no-xml])
AM_GLIB_GNU_GETTEXT

AM_PROG_LIBTOOL

#######
# Gtk 3
#######
AM_PATH_GTK_3_0(gtk_required_version, :,
  AC_MSG_ERROR(Test for GTK3+ failed. See the file 'INSTALL' for help.),
  gthread)


AC_MSG_CHECKING([if GTK+ is version 2.99.3 or newer])
if $PKG_CONFIG --atleast-version=2.99.3 gtk+-3.0; then
  have_gtk3=yes
else
  have_gtk3=no
fi

AC_MSG_RESULT($have_gtk_3)

AM_CONDITIONAL(WITH_GNU_LD, test "$with_gnu_ld" = "yes")
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = yes)

dnl Check modules
pkg_modules="	glib-2.0
                gthread-2.0
                libxml-2.0
		cairo
                gdk-2.0
                gtk+-2.0 >= 2.12"


PKG_CHECK_MODULES(spotlighter, [gtk+-3.0])

AC_CHECK_PROGS(XDG_UTILS, [xdg-desktop-menu], [])

AC_CONFIG_FILES([
Makefile
po/Makefile.in
docs/spotlighter.1
docs/Makefile
src/Makefile
desktop/Makefile
])

AC_OUTPUT
